package com.qyer.commons.http;

import java.util.Collections;

/**
 * User: Z J Wu Date: 2016/02/23 Time: 15:00 Package: com.qyer.commons.http
 */
public class NormalHttpResult extends HttpResult {

  public static HttpResult createEmptyNormalResult(String serviceName, String namespace,
                                                   String requestId, long timeuse) {
    return new NormalHttpResult(serviceName, namespace, timeuse,
                                new InnerHttpResult(requestId, DEFAULT_STRA,
                                                    Collections.emptyList()));
  }

  public static HttpResult createNormalResult(String serviceName, String namespace,
                                              String requestId, String strategy, long timeuse,
                                              Object data) {
    return (data == null) ? createEmptyNormalResult(serviceName, namespace, requestId, timeuse)
                          : new NormalHttpResult(serviceName, namespace, timeuse,
                                                 new InnerHttpResult(requestId, strategy, data));
  }

  public NormalHttpResult() {
  }

  public NormalHttpResult(String serviceName, String namespace, long timeuse,
                          InnerHttpResult data) {
    super(serviceName, namespace, STATUS_OK, OK, timeuse, data);
  }
}
